﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Collections;
using GPCSC.Webs;
using GPCSC.Model;
using NickLee.Common;
using System.Text;
using ExtAspNet;

namespace GPCSC.Web.SHFW
{
    public partial class CLpy : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                btnDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("至少选择一项！");
                f_bound();
            }
        }
        protected void f_bound()
        {
          
            DataSet ds = new CL_PY().CLF_bound();
            if (ds.Tables.Count > 0)
            {
                Grid1.DataSource = ds.Tables[0];
                Grid1.DataBind();
            }

        }
        protected string GetEditUrl(object id)
        {
            return "javascript:" + Window1.GetShowReference("CLpyEdit.aspx?id=" + id.ToString());
        }
        protected void Window1_Close(object sender, EventArgs e)
        {
            f_bound();

        }
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            GPCSC.Webs.databyhtable dh = new databyhtable();
            Hashtable htable = new Hashtable();
            //StringBuilder sb = new StringBuilder();
            foreach (int row in Grid1.SelectedRowIndexArray)
            {
                htable.Clear();
                htable.Add("zt", 1);
                htable.Add("CLdate", DateTime.Now);
                dh.databyhtables(htable, "update", "CL_PY", "pyid", Grid1.DataKeys[row][0].ToString());
                //sb.Append(Grid1.DataKeys[row][0].ToString());
                //sb.Append(",");
            }
            f_bound();
            Alert.ShowInTop("状态更改成功!");
        }

        protected void Button1_Click(object sender, EventArgs e)
        {

        }
    }
}